///////////////////////////////////////////////////////////////////////////
//
// Spring Engine Source File.
// Copyright (C), Dengtao 2011-2021
// ----------------------------------------------------------------------
// File name:   SfNotificatin.cpp
// Version:     v1.0.0
// Created:     2013/06/21 22:47 by dengtao
// Compilers:   Visual Studio 2008
// Description: 
// ----------------------------------------------------------------------
// History:
//
///////////////////////////////////////////////////////////////////////////

#include "SfNotification.h"

namespace Sunflower
{
//
//Summary:
//	constructor.
Notification::Notification()
	: m_ID(Notification::InvalidNotificationId)
{
}

Notification::Notification(unsigned int id)
	: m_ID(id)
{

}

Notification::Notification(const Notification& other)
{
	this->m_ID = other.m_ID;
	this->m_UseInfoDic = other.m_UseInfoDic;
}

//
//Summary:
//	operator =
Notification& Notification::operator =(const Notification& other)
{
	this->m_ID = other.m_ID;
	this->m_UseInfoDic = other.m_UseInfoDic;

	return *this;
}

//
//Summary:
//	destructor.
Notification::~Notification()
{

}

//
//Summary:
//	retrieves extra-info by given name.
NotificationExtraInfo* Notification::GetExtraInfoNamed(const char* name)
{
	if (SfIsValidPtr(name))
	{
		ExtraInfoDictionaryIterator it = m_UseInfoDic.find(name);

		if (it != m_UseInfoDic.end())
		{
			return it->second;
		}
	}

	return SfNull;
}

//
//Summary:
//	add extra-info.
void Notification::AddExtraInfo(NotificationExtraInfo* extraInfo)
{
	if (SfIsValidPtr(extraInfo))
	{
		m_UseInfoDic[extraInfo->GetKey()] = extraInfo;
	}
}

//
//Summary:
//	remove extra-info.
void Notification::RemoveExtraInfoNamed(const char* name)
{
	if (SfIsValidPtr(name))
	{
		m_UseInfoDic[name] = SfNull;
	}
}

} // end of namespace Sunflower
